feat: add Premium Geo DB addon to project settings#2981
Conversation
Adds a Premium Geo DB section to the project settings page so users can enable and disable the premium geolocation addon per-project on cloud. The section supports the full addon lifecycle: - Upgrade prompt when the current plan does not support the addon - Enable flow with optional 3DS payment authentication - Pending state with cancel & retry option - Active state with disable action - Scheduled-for-removal state with re-enable action Uses the new project-scoped SDK methods: listAddons, createPremiumGeoDBAddon, and deleteAddon. Bumps the @appwrite.io/console SDK pin accordingly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Greptile SummaryThis PR adds a Premium Geo DB addon section to the project settings page, mirroring the existing BAA pattern with full lifecycle support: upgrade prompt, enable (with 3DS), pending/refresh, active, scheduled-for-removal, and re-enable flows. It also adds per-project addon rows to the billing plan summary table and bumps the SDK pin.
Confidence Score: 5/5Safe to merge; the core enable/disable/re-enable flows all complete correctly, and the one inconsistency in handleReEnable produces a suboptimal UX (unnecessary redirect) rather than a broken flow. The addon lifecycle is well-structured and the critical 3DS handling in the enable modal is correct. The only new finding is that handleReEnable omits redirectIfRequired: true, so non-3DS re-enable always triggers a full page redirect via the onMount handler instead of resolving inline — the end result is the same, just with an avoidable page reload. premiumGeoDB.svelte — specifically the handleReEnable function's confirmPayment call Important Files Changed
Reviews (32): Last reviewed commit: "fix(premiumGeoDB): inspect payment outco..." | Re-trigger Greptile |
Mirrors the BAA addon UX by fetching the addon price via organizations.getAddonPrice(Addon.Premiumgeodb) from the settings page loader, passing it through to the Premium Geo DB card and enable modal, and rendering the monthly/prorated breakdown with formatCurrency alongside the Enable CTA. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…name - Each project row in the organization billing breakdown now iterates its resources for addon_* entries (amount > 0) and renders them as child rows (e.g. Premium Geo DB under the project it was enabled on). The backend already filters project-scoped addons out of the team-level resources response, so the org "Addons" section shows only org-scoped addons (BAA, premiumGeoDBOrg) while project-scoped ones surface where they belong. - Org-level addon labels now read addon.name from the UsageResource payload that the getAggregation endpoint populates from billingAddons config. Dropped the hard-coded billingAddonNames map so new addons surface with their proper name without a console update. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…geo-db-addon # Conflicts: # bun.lock # package.json # src/routes/(console)/project-[region]-[project]/settings/+page.svelte
…geo-db-addon # Conflicts: # bun.lock # package.json
…DK methods" This reverts commit 304142c.
…geo-db-addon # Conflicts: # src/routes/(console)/project-[region]-[project]/settings/+page.svelte # src/routes/(console)/project-[region]-[project]/settings/+page.ts
…geo-db-addon # Conflicts: # bun.lock # package.json
…geo-db-addon # Conflicts: # bun.lock # package.json
…h for premium geoDB Two missing pieces vs the BAA addon flow: 1. After Stripe redirects back from 3DS with ?type=confirm-addon&addonId=..., the page didn't read the query params or call the confirmations endpoint, so the addon stayed pending forever. Port the onMount handler from BAA.svelte. 2. The pending-state action was "Cancel & retry" which deleted the addon and forced a fresh 3DS flow. That's wasteful when the payment just needs a server-side status sync. Replace with "Refresh" — calls the confirmations endpoint, which live-queries Stripe and activates the addon if the PaymentIntent has transitioned to succeeded. Backend cleans up on 402.
The console SDK bump in this PR renamed Locale to CloudLocale, breaking svelte-check with 7 errors across billing/Soc2/address components.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…geo-db-addon # Conflicts: # bun.lock # package.json # src/routes/(console)/organization-[organization]/billing/planSummary.svelte # src/routes/(console)/project-[region]-[project]/settings/+page.svelte
…geo-db-addon # Conflicts: # bun.lock # package.json
handleReEnable discarded the createPremiumGeoDBAddon return value and always reported success. If the endpoint returns a PaymentAuthentication (payment/3DS required) instead of an Addon, the challenge was never initiated — the addon would sit in `pending` while the UI claimed it was re-enabled. Mirror the enable modal: detect the `clientSecret` branch and drive confirmPayment (which redirects to ?type=confirm-addon so the existing onMount handler completes the payment). Matches BAA.svelte's handleReEnable pattern. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Project-scoped addon resources (addon_premiumGeoDB) are rebuilt by the cloud project aggregator without a `name` field, so the per-project breakdown rows — which used `addon.name || addon.resourceId` — rendered the raw resourceId. Add premium geo entries to billingAddonNamesFallback and apply the map in the breakdown rows too (previously only the top-level addons section used it), so the label degrades to "Premium Geo DB" instead of "addon_premiumGeoDB". Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Latest console SDK build with the project-level premium geo DB addon
methods (createPremiumGeoDBAddon, confirmAddonPayment) resolving to the
correct /projects/{projectId}/addons/... endpoints.
…geo-db-addon # Conflicts: # bun.lock # package.json
Latest console SDK build; project premium geo DB addon methods
(createPremiumGeoDBAddon, confirmAddonPayment) resolve to the correct
/projects/{projectId}/addons/... endpoints.
…geo-db-addon # Conflicts: # bun.lock # package.json
Summary
Adds a Premium Geo DB section to the project settings page so users can enable and disable the premium geolocation addon per-project on cloud.
The section supports the full addon lifecycle, mirroring the BAA pattern at the organization level:
Uses the new project-scoped SDK methods shipped with the cloud update:
listAddons,createPremiumGeoDBAddon, anddeleteAddon. Bumps the@appwrite.io/consoleSDK pin accordingly.Test plan
🤖 Generated with Claude Code